ccR.Add_Rotation(
	1, -- Player Specialization
	"CC_Elemental_Solo", -- Function name
	"Developed early WoD, Not recommended.", -- Description
	"CC_Elemental_Talents", -- Talents button frame
	"CC_Elemental_Abilities", -- Abilities button frame
	"CC_Elemental_Features", -- Features button frame
	"CC_Elemental_Setup" -- Setup button frame
)
function CC_Elemental_Solo()
	--Buffs
	--Cooldowns
	--Move Totems
	if ccR.Spell.Is.Ready(TOTEMIC_PROJECTION) 
	and ccR.Player.HasTotem(SEARING_TOTEM) 
	and ((ccR.Target.Exists() and ccR.Player.Totem.Distance(SEARING_TOTEM, "target") >= 38) or (not ccR.Target.Exists() and ccR.Player.Totem.Distance(SEARING_TOTEM, "player") >= 38)) 
	then
		ccR.Cast.Spell(TOTEMIC_PROJECTION)
		if ccR.Target.Exists() and SpellIsTargeting() then 
			CastAtPosition(ObjectPosition("target")) 
		elseif SpellIsTargeting() then 
			CastAtPosition(ObjectPosition("player")) 
		end
	end

	if ccR.Target.Is.Attackable() then
		--Totem
			-- Fire Elemental Totem
			if not ccR.Player.Has.Totem(FIRE_ELEMENTAL_TOTEM)
			and ccR.Spell.Is.Ready(FIRE_ELEMENTAL_TOTEM)
			then
				ccR.Cast.Spell(FIRE_ELEMENTAL_TOTEM)			
			end
			-- Searing Totem
			if not ccR.Player.IsMoving()
			and (not ccR.Player.Has.Totem(SEARING_TOTEM) or (ccR.Player.Has.Totem(SEARING_TOTEM) and ccR.Player.Totem.Distance(SEARING_TOTEM, "target") >= 40))
			and ccR.Spell.Is.Ready(SEARING_TOTEM)
			and not ccR.Player.Has.Totem(FIRE_ELEMENTAL_TOTEM)
			then
				ccR.Cast.Spell(SEARING_TOTEM)
			end

		if ccR.Spell.Is.Ready(ANCESTRAL_SWIFTNESS) and ccR.Player.Has.Spell(ANCESTRAL_SWIFTNESS) then ccR.Cast.Spell(ANCESTRAL_SWIFTNESS) end
		if ccR.Player.Has.Buff(LAVA_SURGE) and ccR.Spell.CanAttack(LAVA_BURST) then ccR.Cast.Attack(LAVA_BURST) end
	end
	
	if not ccR.Player.Has.Buff(LIGHTNING_SHIELD) and ccR.Spell.Is.Ready(LIGHTNING_SHIELD) then ccR.Cast.Spell(LIGHTNING_SHIELD) end --Self Heal
	if ccR.Player.Count(10) >= 10 and ccR.Spell.Is.Ready(THUNDERSTORM) then ccR.Cast.Spell(THUNDERSTORM) end --ThunderStorm >10 targets 

	-- AoE Rotation
	if (ccR.Var("AutoAoE") and ccR.Target.Count(10) >= 4) or ccR.Var("ManualAoE") then
		--Earthquake
		if ccR.Spell.Is.Ready(EARTHQUAKE) 
		and not ccR.Player.Is.Moving() 
		and (not ccR.Target.Has.My.Debuff(EARTHQUAKE) or ccR.Target.Has.My.DebuffDuration(EARTHQUAKE, "<=", 2))
		then
			ccR.Cast.AoE(EARTHQUAKE, "target", 35, 8)
		end
		if ccR.Target.Is.Attackable() and ccR.Player.Is.Facing("target") then
			if ccR.Spell.CanAttack(FLAME_SHOCK) and (not ccR.Target.Has.My.Debuff(FLAME_SHOCK) or ccR.Target.Has.My.DebuffDuration(FLAME_SHOCK, "<=", 9)) then ccR.Cast.Attack(FLAME_SHOCK) end
			if ccR.Player.Has.Buff(ELEMENTAL_ASCENDANCE) and ccR.Spell.CanAttack(LAVA_BEAM) then ccR.Cast.Attack(LAVA_BEAM) end -- if ascendance
			if ccR.Spell.CanAttack(EARTH_SHOCK) and ccR.Player.Has.Buff(LIGHTNING_SHIELD) and ccR.Player.BuffStacks(LIGHTNING_SHIELD) >= 15 then ccR.Cast.Attack(EARTH_SHOCK) end -- 15 stacks of lightning shield
			if ccR.Spell.CanAttack(CHAIN_LIGHTNING)	then ccR.Cast.Attack(CHAIN_LIGHTNING) end
		end
		return
	end

	if ccR.Target.Is.Attackable() and ccR.Player.Is.Facing("target") then
		if ccR.Spell.CanAttack(LAVA_BURST) and ccR.Target.Has.My.Debuff(FLAME_SHOCK) and ccR.Target.Has.My.DebuffDuration(FLAME_SHOCK, ">", (select(4, GetSpellInfo(LAVA_BURST)) + 1.25)) then ccR.Cast.Attack(LAVA_BURST) end --if flameshock expires soon
		if ccR.Spell.CanAttack(FLAME_SHOCK) and (not ccR.Target.Has.My.Debuff(FLAME_SHOCK) or ccR.Target.Has.My.DebuffDuration(FLAME_SHOCK, "<=", 9)) then ccR.Cast.Attack(FLAME_SHOCK) end
		if ccR.Spell.CanAttack(EARTH_SHOCK) and ccR.Player.Has.Buff(LIGHTNING_SHIELD) and ccR.Player.BuffStacks(LIGHTNING_SHIELD) >= 12 then ccR.Cast.Attack(EARTH_SHOCK) end -- 12 Charges of lightning shield
		--EarthQuake if T16
		if ccR.Spell.CanAttack(ELEMENTAL_BLAST) then ccR.Cast.Attack(ELEMENTAL_BLAST) end
		if ccR.Spell.CanAttack(LAVA_BURST) then ccR.Cast.Attack(LAVA_BURST) end
		--endtotem
		if ccR.Spell.CanAttack(LIGHTNING_BOLT) then ccR.Cast.Attack(LIGHTNING_BOLT) end
	end
end